// 调试：分析 message.route.ts 的路径解析
const filePath = '/Users/jago/Documents/trae_projects/fullstack/guigu_front_template/src/features/crud/message/message.route.ts';

console.log('文件路径:', filePath);

// 模拟 extractPathSegments 的逻辑
const extractPathSegments = (filePath) => {
  // 匹配 /features/{module}/{...path}/xxx.route.ts，其中 module 不是 constant
  const match1 = filePath.match(/\/features\/([^/]+)\/(.+)\/[^/]+\.route\.ts$/);
  if (match1 && match1[1] !== 'constant') {
    console.log('匹配到模式1:', match1);
    console.log('  module:', match1[1]);
    console.log('  path:', match1[2]);
    return match1[2].split('/');
  }

  // 如果是顶层路由文件，如 /features/common/acl/acl.route.ts
  const match2 = filePath.match(/\/features\/([^/]+)\/([^/]+\.route\.ts)$/);
  if (match2) {
    console.log('匹配到模式2 (顶层):', match2);
    console.log('  module:', match2[1]);
    console.log('  route file:', match2[2]);
    return [];
  }

  console.log('未匹配到任何模式');
  return [];
};

const segments = extractPathSegments(filePath);
console.log('\n提取的路径段:', segments);

// 查看实际 message.route.ts 的内容
console.log('\n检查 message.route.ts 的路由配置:');
const fs = require('fs');
const routeContent = fs.readFileSync(filePath, 'utf-8');
console.log(routeContent);
